<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="../static/css/bootstrap.css" />
	<!--需要在Javascript之前引入JQuer-->
	<script type="text/javascript" src="../static/js/jquery-1.11.0.js"></script>
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script type="text/javascript" src="../static/js/bootstrap.js"></script>
	<!--针对移动设备的样式，为了确保适当的绘制和触屏缩放-->
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!--jquery.cookie.js-->
	<script src="../static/js/jquery.cookie.js"></script>
</head>
	<body style=" color: #7d8b8d;background: #f0eef5;">
	<div class="bgcolor bgcolor_open">
		<style>
			.bgcolor_open{background-color: #eee;}
			.bgcolor_close{background-color: #555;}
		</style>
	    <div class="row clearfix">
	        <div class="col-md-12 column">
				<div class="row clearfix" title="top_img">
					<div class="col-md-12 column">
						<img src="../static/img/header.png" width="100%" height="80px" />
					</div>
				</div>
	            <div class="row clearfix" title="top">
	                <div class="col-md-12 column">
	                	<!--头部-->
	                	<nav class="navbar-inverse container-fluid" role="navigation" style="background-color: #444;">
							<div class="container-fluid" style="padding: 0 30px 0 30px;"> 
						    <div class="navbar-header">
						        <a class="navbar-brand" href="/">
						        	<font color="#F9F9F9">留言part</font>
						        </a>
						    </div>
						    <div>
						        <!--向左对齐-->
						        <ul class="nav navbar-nav navbar-left">
						            <li class="dropdown">
						                <a href="/">
						                    首页
						                    <b class="caret"></b>
						                </a>
						                
						            </li>
						        </ul>
						       <!-- 向左对齐-文本-->
						        <!--向右对齐-->
						         <ul id="nav_right" class=" nav navbar-nav navbar-right">
				                    <li class="dropdown" style="display: none;">
				                        <form class="navbar-form navbar-right" >
									        <div class="form-group">
									         <div class="input-group">
									          <input type="text" class="form-control" placeholder="代码改变世界" style="border-radius:25px;">
									          <span class="input-group-btn" style="right:40px">
									          	<button type="submit" class="btn btn-default" style="border: none;background: none;">
									          	<span class="glyphicon glyphicon-search">
									          	</span>
									            </button>
									          </span>
									          </div>
									        </div>
									    </form>
				                    </li>
									 <li>
										 <a href="/login" class="" style="color: white;">登录</a>
									 </li>
									 <li>
										 <a href="/user" class="" style="color: white;">注册</a>
									 </li>

				                </ul>
						       <!-- 向右对齐-文本-->
						    </div>
							</div>
						</nav>
						<!--头部-->
	                </div>
	            </div>

	            <div class="row clearfix" title="top_img">
					<div class="col-md-12 column">
						<img src="../static/img/t1.png" width="100%" height="30px" />
					</div>
				</div>
				<div class="container" >
					<div class="row clearfix " title="main" style="background: white;">
						<div class="col-md-12 column MSG ">
							<!--信息内容-->
							<div class="row clearfi" style="padding: 0 15px;" hidden>
								<h2>
									Heading
								</h2>
								<p>
									Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo,
								</p>
							</div>
							<!--信息内容-->
							<!--作者列表-->
							<div class="list-group-item" style="border-left: none; border-right: none;" hidden>
								<article>
									<section >
										<div >
											<div class="row clearfix">
												<div class="col-md-12 column">
													<div class="media">
														<a href="#" class="pull-left"><img src="../static/img/header/cs40006.png" width="70px" height="70px" class="media-object" alt='' /></a>
														<div class="media-body">
															 <span style="padding-left: 10px;">
																 <span>作者：</span>
																 <span >清风紫雪</span>
															     </span>
																<br>
																<span style="padding-left: 10px;">
																<span>发表时间：</span>
																  <span>2021-01-24 20:04</span>
															  </span>
															<br>
															<a class="btn" href="#">
																<span>点赞：</span>
																<span class="glyphicon glyphicon-thumbs-up" style="color: rgb(175, 175, 230);"></span>
																<span>0</span>
															</a>
														</div>
													</div>
												</div>
											</div>
										</div>
									</section>
									<figure>
										阅读（10） 评论（2）
									</figure>
								</article>
							</div>
							<!--作者列表-->
						</div>
					</div>
					<script>
						//个人资料按钮
						function PersonalInfo() {
							var userId = $.cookie("userId");
							var href = "/user?status=1&id=" + userId;
							window.location.replace(href);
						}
						//退出登录
						function LoggingOut() {
							$.removeCookie("userId");
							$.removeCookie('headpic');
							$.removeCookie('login_username');
							$.removeCookie('aut_name');
							$.removeCookie('msg_id');
							$.removeCookie('num');
							// $.cookie('userId', null);
							window.location.replace("/login.html");
						}
						//遍历文章
						$(function () {
							var msg_id = $.cookie("msg_id")
							$.get("/content/getone?msg_id="+msg_id,function (Msg,state) {
								console.log(Msg);
								$(".MSG").empty();
								$.cookie("aut_name",Msg.Name);
								var HeartNum = $.cookie("num");
								var trhtml = "";
								trhtml +="<!--信息内容-->"+
										"<div class=\"row clearfi\" style=\"padding: 0 15px;\" >" +
										"<h2>"+Msg.Hdline+"</h2>" +
										"<p>"+Msg.Text+"</p>" +
										"</div>" +
										"<!--信息内容-->" +
										"<!--个人信息内容-->" +
										"<div class=\"list-group-item\" style=\"border-left: none; border-right: none;\">" +
										"<article>" +
										"<section >" +
										"<div >" +
										"<div class=\"row clearfix\">" +
										"<div class=\"col-md-12 column\">" +
										"<div class=\"media\">" +
										"<a href=\"#\" class=\"pull-left\"><img src=\"../static/img/header/"+Msg.Headpic+"\" width=\"100px\" height=\"100px\" class=\"media-object\" alt='' /></a>" +
										"<div class=\"media-body\">" +
										"<span style=\"padding-left: 10px;\">" +
										"<span>作者：</span><span >"+Msg.Name+"</span></span><br>" +
										"<span style=\"padding-left: 10px;\"><span>发表时间：</span><span>"+Msg.Cr_time+"</span></span><br>" +
										"<span style=\"padding-left: 10px;\"></span>邮箱：<span >"+Msg.Emil+"</span></span><br>" +
										"<a class=\"btn\" href=\"#\">" +
										"<span>点赞：</span><span class=\"glyphicon glyphicon-thumbs-up thumbUpBtn\" style=\"color: rgb(175, 175, 230);\"></span>" +
										"<span id='TmbNum'>"+HeartNum+"</span> <span id='hint' style='color: red'></span>" +
										"</a>" +
										"</div>" +
										"</div>" +
										"</div>" +
										"</div>" +
										"</div>" +
										"</section>" +
										"<figure>" +
										"访问人数 (<span id='call_on'>0</span>)" +
										" 评论数 (<span id='remark_num'>0</span>)" +
										"</figure>" +
										"</article>" +
										"</div>" +
										"<!--个人信息内容-->"
								;
								$(".MSG").html(trhtml);
								//点赞处理
								$(".thumbUpBtn").click(function (){
									alert("请先登录后操作！");

							});
						 });
						});
					</script>
					<div class="row clearfix;" style="height: 30px;"></div>
					<div class="row clearfix " title="main" style="background: white;">
						<div class="col-md-12 column" style="background: white;">
							<!--评论列表-->
							<div style="margin-top: 20px;border-bottom: 2px solid #8C8C8C;"><font size="4">评论列表</font></div>
							<div class="list-group-item Critic" style="border-left: none; border-right: none;">
								<!--列表内容-->
								<article>
									<section >
										<div hidden>
											<div class="row clearfix">
												<div class="col-md-12 column">
													<div class="media">
													<span style="padding-left: 10px;">
													  	<span style="color: #337ab7;">#<span>1</span>楼</span>
													  	<span id="send_time">2021-01-24 20:04</span>
										                 <span id="accept_name" user_id="1" style="color: #337ab7;">清风紫雪</span>
										                 <span style="float: right;">
													  	   <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" style='text-decoration:none;'><button onclick="reply()" style="background: none; border: hidden;">回复</button></a>
										                 </span>
										            </span>
														<div class="media-body">
														 <span style="padding: 10px 20px;">
														  	解放后设法是
											             </span>
															<br />
															<span style="float: right;">
														  	<a href="#" style='text-decoration:none;'>支持（0）</a> <a href="#" style='text-decoration:none;'>反对（0）</a>
											             </span>
														</div>
													</div>
													<div class="panel panel-default">
														<div id="collapseOne" class="panel-collapse collapse">
															<div class="panel-body">
																<div class="col-md-10">
																	<textarea id="content_id" class="form-control" rows="1" placeholder="简介......"  style=" border-top:hidden; border-left:hidden ; border-right:hidden ;"></textarea>
																</div>
																<div class="col-md-2">
																	<button type="button"  class="btn btn-block btn-group-lg btn-info">发送</button>
																</div>
															</div>
														</div>
													</div>
												</div>
											</div>
										</div>
									</section>
								</article>
								<!--列表内容-->
							</div>
							<!--评论列表-->
							<script type="text/javascript">
								//遍历评论列表
								$(function () {
									var message_id = $.cookie("msg_id");
									if (message_id.length<0 || message_id =="" || message_id == null){
										window.location.replace("/content/detail");
									}
									var url = "/message/list"
									$.get(url, {message_id: message_id}, function (CriData,Sta) {
										console.log(CriData);
										$(".Critic").empty();
										var trhtml = "";
										if (CriData.CommentList.length == 0){
											$(".Critic").html("<h4>暂无评论......</h4>");
										}else {
											//登录用户名
											var send_name = $.cookie("login_username");
											//作者用户名
											var aut_name = $.cookie("aut_name");
											//文章的id
											var message_id = $.cookie("msg_id");
											for ( i in CriData.CommentList){
												//判断被评论者与作者的用户名是否相同
												var acceptor_name = CriData.CommentList[i].Accept_name;
												if (aut_name !== acceptor_name){
													var accept_name = "@"+acceptor_name+"~：";
												}else {
													accept_name = "";
												}
												//判断评论者与登录用户的用户名是否相同
												if(CriData.CommentList[i].Send_name == send_name){
													var effect1 = "hidden";
													var effect2 = "";
												}else {
													effect1 ="";
													effect2 = "hidden";
												}
												var effect3 ="hidden";
												//判断登录者与被评论者
												if(send_name == acceptor_name){
													//判断状态状态是否已查
													var status = Number(CriData.CommentList[i].Status);
													if (status == 0) {
														//修改状态
														$.ajax({
															type: "POST",
															url: "/message/statue",
															data: {c_id:CriData.CommentList[i].Id,sta:1},
															success: function (s) {
																console.log("状态已经改变"+s)
															}
														});
														effect3 = "";
													}
												}
												//判断是否是超级用户
												if ("admin"== send_name){
													 effect1 = "";
													 effect2 = "";
												}
												var l = parseInt(i)+1;
												trhtml +="<!--列表内容-->" +
												"<article>" +
												"<section >" +
												"<div >" +
												"<div class=\"row clearfix\">" +
												"<div class=\"col-md-12 column\">" +
												"<div class=\"media\">" +
												"<span style=\"padding-left: 10px;\">" +
												"<span style=\"color: #337ab7;\">" +
												"<a href=\"#\" "+effect3+">"+
												"<span class=\"badge\" style='background-color: red;' >" +
												"<span class=\"glyphicon glyphicon-bell\" style=\"color: white;\"></span>" +
												"</span> " +
												"</a>"+
												"# <span>"+l+"</span> 楼 </span>" +
												"<span id=\"send_time\">"+CriData.CommentList[i].Send_time+"</span>" +
												"<span id=\"accept_name_"+l+"\" style=\"color: #337ab7;\"> "+CriData.CommentList[i].Send_name+" </span>" +
												"<span id=\"span_"+l+"\" style=\"float: right;\" >" +
												"<a data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#collapse"+l+"\" style='text-decoration:none;' "+effect1+">" +
												"<button id='btn"+l+"' class='btn' onclick='document.getElementById(\"content_"+l+"\").placeholder=\"@"+CriData.CommentList[i].Send_name+"\"' style=\"background: none; border:none;\">回复</button>" +
												"</a>" +
												"<a href=\"#\" onclick='Trash("+CriData.CommentList[i].Id+")' "+effect2+">"+
												"<button class='btn' style=\"background: none; border:none;\">删除</button>" +
												"</a>" +
												"</span>" +
												"</span>" +
												"<div class=\"media-body\">" +
												"<span style=\"padding: 20px 20px;\">"+accept_name+"“"+CriData.CommentList[i].Content+"”</span><br/>" +
												"<span style=\"float: right;\">" +
												"<button c_id='"+CriData.CommentList[i].Id+"' class='btn btn-info Support' id='Sup_"+l+"'>支持("+CriData.CommentList[i].Support+")</button><button c_id='"+CriData.CommentList[i].Id+"' class='btn btn-danger Oppose' id='Ops_"+l+"'>反对("+CriData.CommentList[i].Oppose+")</button> " +
												"</span>" +
												"</div>" +
												"</div>" +
												"<div class=\"panel panel-default\">" +
												"<div id=\"collapse"+l+"\" class=\"panel-collapse collapse\">" +
												"<div class=\"panel-body\">" +
												"<div class=\"col-md-10\">" +
												"<textarea id=\"content_"+l+"\" class=\"form-control\" rows=\"1\" placeholder=\"简介......\"  style=\" border-top:hidden; border-left:hidden ; border-right:hidden ;\"></textarea>" +
												"</div>" +
												"<div class=\"col-md-2\">" +
												"<button  content_id=\"content_"+l+"\" accept_name=\""+CriData.CommentList[i].Send_name+"\" class=\"btn btn-block btn-group-lg btn-info\" id=\"Reply\">发送</button>" +
												"</div>" +
												"</div>" +
												"</div>" +
												"</div>" +
												"</div>" +
												"</div>" +
												"</div>" +
												"</section>" +
												"</article>" +
												"<!--列表内容-->";

											};
											$(".Critic").html(trhtml);
											//评论数
											$("#remark_num").html(""+l+"");
											//获取访问人数
											var newArr= [];
											var arrId = [];
											for(var item of CriData.CommentList){
												if(arrId.indexOf(item['Send_name']) == -1){
													arrId.push(item['Send_name']);
													newArr.push(item);
												}
											}
											// console.log(arrId,newArr);
											$("#call_on").html(""+arrId.length+"");
											//判断是否已经被禁言
											var State = $.cookie("Status")
											if(State == "1"){
												alert("你已经被禁言，请通过联系用户管理人员解除禁言！");
											}else{
												// 回复评论
												$("[id=Reply]").click(function (){
													alert("请先登录后操作！");
												});
												//支持or取消支持
												$(".Support").click(function () {
													alert("请先登录后操作！");
												});
												//反对或取消反对
												$(".Oppose").click(function () {
													alert("请先登录后操作！");
												});
											}

										}
									});
									setTimeout(function () {
										$.removeCookie("msg_id");
									},500000);
								});
								//删除评论
								function Trash(id) {
									var delUrl ="/message/del?c_id="+id;
									$.post(delUrl,function (success) {
										alert("删除成功！");
										window.location.reload();
									})
								}
							</script>
						</div>
					</div>
					<div class="row clearfix ">
						<div class="col-md-12 column ">
							<p>
								<a href="#"  class="btn btn-default btn-md navbar-right goTop-hook" role="button">返回顶部</a>
								<script>
									// 点击返回顶部
									$(window).scroll(function() {
										if ($(window).scrollTop() >= 100) {
											$(".goTop-hook").fadeIn(300)
										} else {
											$(".goTop-hook").fadeOut(300)
										}
									})

									$(".goTop-hook").bind("click", function() {
										$("html").animate({ scrollTop: 0 }, 300)
									})
									function refresh() {
										window.location.reload();//刷新当前页面.

										//或者下方刷新方法
										//parent.location.reload()刷新父亲对象（用于框架）--需在iframe框架内使用
										//opener.location.reload()刷新父窗口对象（用于单开窗口)
										//top.location.reload()刷新最顶端对象（用于多开窗口）
									}
								</script>
								<a href="#" onclick="refresh()" class="btn btn-default btn-md navbar-right" role="button">刷新页面</a>
							</p>
						</div>
					</div>
					<div class="row clearfix" title="remark" style="background: white;">
						<div class="col-md-12 column">
							<div class="row clearfix" >
								<div class="col-md-10" style="padding: 10px 10px;">
									<span class="glyphicon glyphicon-edit"><trans oldtip=" Edit" newtip="编辑">发表评论</trans></span>
									<div style="border:1px solid; border-color: #ddd;">

										<ul id="myTab" class="nav nav-tabs">
											<li class="active">
												<a href="#home" data-toggle="tab">
													编辑</a>
											</li>
										</ul>
										<div style="padding: 5px 10px;">
											<div id="myTabContent" class="tab-content">
												<div class="tab-pane fade in active" id="home">
													<div class="form-group">
												   <textarea id="text_content" class="form-control" cols="6" rows="12" placeholder="简介......" style=" border-top:hidden; border-left:hidden ; border-right:hidden ;"></textarea>
													</div>
												</div>
											</div>
										</div>
									</div>
									<button onclick="Discuss()">提交评论</button>
								</div>
							</div>
						</div>
					</div>
				</div>
				<script>
					function Discuss() {
						//判断是否已经被禁言
						var State = $.cookie("Status")
						if(State == "1"){
							alert("你已经被禁言，请通过联系用户管理人员解除禁言！");
						}else {
							alert("请先登录后操作！");
						}
					};
				</script>
	            <div class="row clearfix" title="footer">
					<div class="col-md-12 column">
						<footer id="footer" class="footer">\
							<center>
				            <div id="friend_link" class="">
							    友情链接：
							    <a href="//www.vpsor.cn" target="_blank">硅云</a>
							    <a href="//aws.amazon.com" target="_blank">AWS</a>
							    <a href="//www.aliyun.com" target="_blank">阿里云</a>
							    <a href="//cloud.tencent.com" target="_blank">腾讯云</a>
							    <a href="//www.huaweicloud.com" target="_blank">华为云</a>
							    <a href="//cloud.baidu.com" target="_blank">百度云</a>
							    <a href="//www.jdcloud.com" target="_blank">京东云</a>
							    <a href="//www.163yun.com" target="_blank">网易云</a>
							    <a href="//www.yisu.com" target="_blank">亿速云</a>
							    <a href="//www.rongcloud.cn" target="_blank">融云</a>
							    <a href="//www.shanhaibi.com/" target="_blank">山海鲸可视化</a>
							    <a href="http://www.gcpowertools.com.cn" target="_blank">葡萄城控件</a>
							    <a href="//www.chinaz.com/" target="_blank">站长之家</a>
							    <a href="http://dev.yesky.com" target="_blank">天极网</a>
							    <a href="//wetest.qq.com/?from=links_cnblogs" target="_blank">腾讯WeTest</a>
							    <a href="http://www.ucancode.com/" target="_blank">工控组态源码</a>
							</div>
				            <div class="footer-splitter" style="margin-top: 10px;margin-bottom: 20px;width: 80%;height: 1px;background-color: #999;"></div>
				            </center>
				        </footer>
					</div>
				</div>
	        </div>
	    </div>
	</div>
	</body>
</html>
